package com.wqm.step.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wqm.step.pojo.Customer;
import com.wqm.step.pojo.Order;
import com.wqm.step.service.OneToManyService;

@Controller
public class OneToManyController{
	
	@Autowired
	private OneToManyService oneToManyService;

	@RequestMapping("/onetomany.action")
	@ResponseBody
	public void saveData() {
		/*Customer c = new Customer();
		c.setName("张三");
		Order o1 = new Order();*/
		Customer c = new Customer();
		c.setName("李四");
		Order o1 = new Order();
		o1.setMoney(90d);
		o1.setAddress("上海");
		Order o2 = new Order();
		o2.setMoney(80.0d);
		o2.setAddress("北京");
		
		oneToManyService.saveData(c,o1,o2);
	}
}
